<?php
class CiDian {
    public function __construct() {
        //
    }
    static public function factory($dict_name,$args=null) {
        $dict=dirname(__FILE__).'/cidian/'.$dict_name.'.php';
        if (file_exists($dict)) {
            require_once $dict; 
            if ($args) {
                return new $dict_name($args);
            } else {
                return new $dict_name;
            }
        }
        throw new Exception('no such dict:'.$dict_name);
    }
}
